<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 400px;
            height: 400px;
            background: pink;
        }
    </style>
</head>
<body>
    <div></div>
    <script>
        var box = document.querySelector("div")
        //e => 事件对象 => 浏览器记录这个事件所有属性与方法
        box.onclick = function(e){//e是一个对象->事件对象
            //处理兼容性
            e = e || window.event
            console.log(e);//记录这次事件的属性与方法
            console.log("我刚刚触发的事件类型:",e.type);
        }
    </script>
</body>
</html>